package com.kb.erp.common;

import lombok.Data;

import java.io.Serializable;

@Data
public class  ApiResponse<T> implements Serializable {
    private int status;
    private String msg;
    private T data;

    public ApiResponse(int status, String msg, T data,Object count) {
        this.status = status;
        this.msg = msg;
        this.data = data;
    }

    // Getters and Setters

    // Optional: You can also add static methods to create common response objects.
    public static <T> ApiResponse<T> success(T data) {
        return new ApiResponse<T>(0, "Success", data,0);
    }
    public static <T> ApiResponse<T> successCount(T data,Object count) {
        return new ApiResponse<T>(0, "Success", data,count);
    }

    public static <T> ApiResponse<T> error(String message) {
        return new ApiResponse<T>(500, message, null,0);
    }
}
